<template>
    <div>
        <page-main>
            <!-- 表格 table -->
            <el-table ref="table" :data="dict.poolList" border stripe highlight-current-row>
                <el-table-column prop="code" label="编号" />
                <el-table-column prop="name" label="线索池名称">
                    <template #default="scope">
                        <span>{{ scope.row.name }} <el-tag v-if="scope.$index==0" size="mini">默认</el-tag></span>
                    </template>
                </el-table-column>
                <!-- <el-table-column prop="" label="开放领取" /> -->
                <el-table-column prop="status" label="状态">
                    <template #default="scope">
                        <span>{{ scope.row.status | statusFilter }}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column prop="member" label="修改人" /> -->
                <!-- <el-table-column prop="created" label="修改时间" /> -->
                <el-table-column fixed="right" label="操作" width="160">
                    <template #default="scope">
                        <el-button type="text" size="small" @click="ruleList(scope.row)">分配规则</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </page-main>
        <!-- 分配规则 -->
        <rule-list-drawer ref="ruleListDrawer" />
    </div>
</template>

<script>
import { mapState } from 'vuex'
import RuleListDrawer from './components/RuleListDrawer'
export default {
    name: 'ClueMine',
    components: {
        RuleListDrawer
    },
    filters: {
        statusFilter(val) {
            const map = {
                0: '禁用',
                1: '启用'
            }
            return map[val]
        }
    },
    data() {
        return {
            loading: false,
            search: {
                user: '', 
                type: '', 
                status: '',
                pages: 1,
                limit: 10,
                total: 0
            }
        }
    },
    computed: {
        ...mapState(["dict"])
    },
    mounted() {
        // this.getList();
    },
    methods: {
        ruleList(row) {
            this.$refs.ruleListDrawer.showDrawer(row); 
        }
    }
}
</script>
